package com.atguigu.gulimail.order.listener;

import com.atguigu.gulimail.order.service.OrderService;
import com.atguigu.gulimail.order.vo.PayAsyncVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
public class OrderPayedListener {

    @Autowired
    OrderService orderService;

    @PostMapping("/payed/notify")
    public String handleAliPayed(PayAsyncVo vo,HttpServletRequest request){

    //        Map<String, String[]> map = request.getParameterMap();
//        for (String s : map.keySet()) {
//            String parameter = request.getParameter(s);
//            System.out.println("参数名:"+s+"  ===参数值:" + parameter);
//        }
//        System.out.println(map);

    // 验签 由于太过麻烦所以不验了
    String result = orderService.handlePayResult(vo);

        return result;
    }



}
